]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboardManager: Remove unnecessary calls
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Dec 2025 11:36:57 +0000 (12:36 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 19 Jan 2026 16:28:44 +0000 (16:28 +0000)
There is no longer need to freeze/unfreeze/ungrab the keyboard.
This API was only effective in the X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4020>

js/misc/keyboardManager.js
js/ui/status/keyboard.js

index 2ecc8facc08d1108702c210f427dd9aba7a320f9..924caa8c881bdfaa944c55785eebe16b3ce0e3ce 100644 (file)
@@ -1,8 +1,6 @@
 import GLib from 'gi://GLib';
 import GnomeDesktop from 'gi://GnomeDesktop';
 
-import * as Main from '../ui/main.js';
-
 export const DEFAULT_LOCALE = 'en_US';
 export const DEFAULT_LAYOUT = 'us';
 export const DEFAULT_VARIANT = '';
@@ -29,17 +27,6 @@ export function getKeyboardManager() {
     return _keyboardManager;
 }
 
-export function releaseKeyboard() {
-    if (Main.modalCount > 0)
-        global.backend.unfreeze_keyboard(global.get_current_time());
-    else
-        global.backend.ungrab_keyboard(global.get_current_time());
-}
-
-export function holdKeyboard() {
-    global.backend.freeze_keyboard(global.get_current_time());
-}
-
 class KeyboardManager {
     constructor() {
         // The XKB protocol doesn't allow for more than 4 layouts in a
index a4d85debdb0e88ed2d4e0625500b3cc760803b15..fe2dc67466b3fb7e125f577bf3344ecd5bd89404 100644 (file)
@@ -408,10 +408,8 @@ export class InputSourceManager extends Signals.EventEmitter {
 
     _modifiersSwitcher() {
         const sourceIndexes = Object.keys(this._inputSources);
-        if (sourceIndexes.length === 0) {
-            KeyboardManager.releaseKeyboard();
+        if (sourceIndexes.length === 0)
             return true;
-        }
 
         let is = this._currentSource;
         if (!is)
@@ -498,16 +496,6 @@ export class InputSourceManager extends Signals.EventEmitter {
     }
 
     activateInputSource(is, interactive) {
-        // The focus changes during holdKeyboard/releaseKeyboard may trick
-        // the client into hiding UI containing the currently focused entry.
-        // So holdKeyboard/releaseKeyboard are not called when
-        // 'set-content-type' signal is received.
-        // E.g. Focusing on a password entry in a popup in Xorg Firefox
-        // will emit 'set-content-type' signal.
-        // https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
-        const holdKeyboard = !this._reloading;
-        if (holdKeyboard)
-            KeyboardManager.holdKeyboard();
         this._keyboardManager.apply(is.xkbId);
 
         let engine;
@@ -519,10 +507,7 @@ export class InputSourceManager extends Signals.EventEmitter {
             engine = `xkb:${name}:${variant}:${lang}`;
         }
 
-        this._ibusManager.setEngine(engine).then(() => {
-            if (holdKeyboard)
-                KeyboardManager.releaseKeyboard();
-        });
+        this._ibusManager.setEngine(engine);
 
         this._currentInputSourceChanged(is);